#!/bin/bash

wakeupword="嗨领克"
online_query_array=("导航到上海迪士尼" "附近的加油站" "中途去一下加油站" "导航到宝安机场不走高速" "我想听周杰伦的歌" "打电话给1 0 0 8 6"
  "播放有声" "今天的天气怎么样" "今天的头条新闻")
offline_query_array=("空调风量tiao2高3档" "打开座椅通风" "关闭天窗" "查看全程" "我想听歌" "车窗打开" "空调温度27度" "给大宝打电话"
  "打开收音机" "缩小地图")

array=None

if [[ $1 -eq 9 ]]; then
  while true; do
    echo $wakeupword
    say $wakeupword
    sleep 8
  done
else
  if [[ $1 -eq 0 ]]; then
    for ((i = 0; i < ${#online_query_array[@]}; i++)); do
      array[i]=${online_query_array[i]}
    done
  else
    for ((i = 0; i < ${#offline_query_array[@]}; i++)); do
      array[$i]=${offline_query_array[i]}
    done
  fi
  while true; do
    for ((i = 0; i < ${#array[@]}; i++)); do
      echo $wakeupword
      say $wakeupword
      sleep 3
      echo ${array[i]}
      say ${array[i]}
      sleep 8
    done
  done
fi
